<?php
session_start();
require("./users2k/basedir.php");
require("./adodb/adodb.inc.php");
require("./Connections/forms2.php");

include("./RenderView/imagen.php");
include("./RenderView/text.php");
include("./RenderView/tabla.php");
include("./RenderView/fechahora.php");
include("./RenderView/option.php");
include("./RenderView/combo.php");
include("./RenderView/check.php");
include("./RenderView/getmyvalue.php");
include("./RenderView/veropciones.php");
include("./RenderView/subform.php");

$SQL="SELECT * FROM preguntas WHERE idpreg=$idpreg";
$rs=$forms2->Execute($SQL) or DIE($forms2->ErrorMsg());

$tipo=$rs->Fields("idtipo"); 
$idform=$rs->Fields("idform");
$ancho=$rs->Fields("ancho");
$parametro1=$rs->Fields("param1");
$parametro2=$rs->Fields("param2");
$nombrecontrol=$rs->Fields("nombrecontrol");
$descripcion=$rs->Fields("descripcion");
$idpreg=$rs->Fields("idpreg");
$idop=$rs->Fields("idopcion");
$multiple=$rs->Fields("multiple");

$tablahist=str_replace("td_","th_",$rs->Fields("tabladest"));
$SQL="SELECT * FROM $tablahist INNER JOIN users ON $tablahist.iduser=users.idusuario 
      WHERE idpreg=$idpreg and $tablahist.id=$id";
$values=$forms2->Execute($SQL) or DIE($forms2->ErrorMsg());?>
<table align="center" width="570" cellpadding="3" cellspacing="0">
	  <tr> 
		<td class="row"><strong>Fecha</strong></td>
		<td class="row"><strong>Valor</strong></td>
		<td class="row"><strong>Usuario</strong></td>
	  </tr><?php 
	  while(!$values->EOF){
	  $valor=$values->fields("valor");
	  $hist=true;?>
	  <tr> 
		<td class="planillacell2" valign="top"><p>
		  <?=$values->Fields("fecha")?>
		</p></td>
		<td class="planillacell2" valign="top"><p>
		  <?php include("./appfront/listcore.php");?>
		</p></td>
		<td class="planillacell2" valign="top"><p>
		  <?=$values->Fields("nombre")." ".$values->Fields("apellido")?>
		</p></td>
	  </tr><?php 
	  $values->Movenext();
	  }?>
</table>
